
const tokens = {
  admin: {
    token: 'admin-token'
  },
  editor: {
    token: 'editor-token'
  }
}

// const users = {
//   'admin-token': {
//     roles: ['admin'],
//     introduction: 'I am a super administrator',
//     avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
//     name: 'Super Admin'
//   },
//   'editor-token': {
//     roles: ['editor'],
//     introduction: 'I am an editor',
//     avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
//     name: 'Normal Editor'
//   }
// }

module.exports = [
  // user login
  {
    url: '/login',
    type: 'post',
    response: config => {
      // const { username } = config.body
      // const token = tokens[username]

      // mock error
      // if (!token) {
      //   return {
      //     code: 60204,
      //     errMessage: 'Account and password are incorrect.'
      //   }
      // }

      return {
        code: 0,
        // data: token,
        errMessage: '',
        level: 0
      }
    }
  },

  // get user info
  {
    url: '/info\.*',
    type: 'get',
    response: config => {
      return {
        code: 0,
        data: 'success'
      }
    }
  },

  // user logout
  {
    url: '/logout',
    type: 'post',
    response: _ => {
      return {
        code: 0,
        data: 'success'
      }
    }
  }
]
